package main

import "fmt"

//断言
func main() {
	var s interface{} = "abc"
	s1, ok := s.(string)
	fmt.Println(s1, ok)

	s2, ok := s.(int)
	fmt.Println(s2, ok)

	switch s.(type) {
	case string:
		fmt.Println("is string")
	case int:
		fmt.Println("is int")
	default:
		fmt.Println("unknown")
	}
}
